<template>
    <div class="app-container">
      <el-table
        v-if="refreshTable"
        v-loading="loading"
        :data="goodsList"
        row-key="id"
      >
        <el-table-column prop="id" label="订单id" :show-overflow-tooltip="true" width="160"></el-table-column>
        <el-table-column prop="userId" label="用户id" align="center" width="100"></el-table-column>
        <el-table-column prop="goodsId" label="货物id" align="center" width="100"></el-table-column>
        <el-table-column prop="name" label="用户名" align="center" width="100"></el-table-column>
        <el-table-column prop="phone" label="电话" align="center" width="100"></el-table-column>
        <el-table-column prop="address" label="地址" align="center" width="100"></el-table-column>
        <el-table-column prop="remark" label="备注" align="center" width="100"></el-table-column>
        
        <el-table-column label="创建时间" align="center" prop="createdTime">
          <template slot-scope="scope">
            <span>{{ parseTime(scope.row.createdTime) }}</span>
          </template>
        </el-table-column>
        <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
          <template slot-scope="scope">
            <el-button
              size="mini"
              type="text"
              icon="el-icon-edit"
              @click="handleUpdate(scope.row)"
              v-hasPermi="['datamanage:storemanage:edit']"
            >修改</el-button>
            <el-button
              size="mini"
              type="text"
              icon="el-icon-delete"
              @click="handleDelete(scope.row)"
              v-hasPermi="['datamanage:storemanage:remove']"
            >删除</el-button>
          </template>
        </el-table-column>
      </el-table>
  
      
    </div>
  </template>
  
  <script>
  import { orderPage,  getOrder,updateOrder,deleteOrder} from "@/api/datamanage/store.js";
  
  export default {
    name: "goods",
    dicts: ['sys_show_hide', 'sys_normal_disable'],
    data() {
      return {
        // 遮罩层
        loading: true,
        // 显示搜索条件
        showSearch: true,
        // 货物表格树数据
        goodsList: [],
        // 弹出层标题
        title: "",
        // 是否显示弹出层
        open: false,
        // 重新渲染表格状态
        refreshTable: true,
        // 查询参数
        queryParams: {
          page: 1,
          pageSize: 10,
          goodsName: undefined,
          visible: undefined
        },
        // 表单参数
        form: {},
        
      };
    },
    created() {
      this.getList();
    },
    methods: {

      /** 查询货物列表 */
      getList() {
        this.loading = true;
        orderPage(this.queryParams.page,this.queryParams.pageSize).then(response => {
          this.goodsList = response.data.records;
          this.loading = false;
        });
      },

      },

      /** 删除按钮操作 */
      handleDelete(row) {
        this.$modal.confirm('是否确认删除名称为"' + row.id + '"的数据项？').then(function() {
          return deleteOrder(row.id);
        }).then(() => {
          this.getList(this.queryParams.page,this.queryParams.pageSize);
          this.$modal.msgSuccess("删除成功");
        }).catch(() => {});
      }
  };
  </script>
  